package chapter14;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/2/21 15:31
 */
public class PropertyTest {
    public static void main(String[] args) throws IOException {
        Properties properties = new Properties();
        try (InputStream inputStream = PropertyTest.class.getClassLoader().getResourceAsStream("config.properties")) {
            properties.load(inputStream);
            System.out.println(properties.get("name"));
            System.out.println(properties.get("age"));
            System.out.println(properties.getOrDefault("work", "programer"));
        }

    }
}
